package com.gather.orm;

// 房子测试类
public class House  implements Comparable<House>{
    private String name;
    private int price;

    public House(String name, int price) {
        this.name = name;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return name+":"+price;
    }

    @Override
    public int compareTo(House o) {
        // 比较价格 大到小排序
        int n = this.price;
        int m = o.getPrice();
        // 不要漏掉 相等情况
        if (n == m) {
            return 0;
        }
        return n > m ? -1 : 1 ;
    }
}
